<!--
 * @Author: 刘十三
 * @Date: 2024-02-26 10:37:30
 * @LastEditors: 刘十三
 * @LastEditTime: 2024-02-27 14:24:13
 * @FilePath: \NM-dev-1.3.1\dev\pages\internal\linkage\todo\components\arrangeTaskRetailerList.vue
 * @Description: 任务派发-零售户信息
-->

<template>
  <view class="form-main">
    <u-form class="u-form-m" :model="retailer" :error-type="['border-bottom']" label-width="auto" label-position="top" ref="uForm">
      <u-form-item label="许可证号" prop="licNo" :required="isFields" :right-icon="isEdit == 'edit' ? 'arrow-right' : ''">
        <u-input placeholder="请选择" v-model="retailer.licNo" :disabled="true" @click="getRetailerInfo"></u-input>
      </u-form-item>
      <u-form-item label="企业字号/商户" prop="companyName" :required="isFields">
        <u-input placeholder="选择许可证后自动显示" v-model="retailer.companyName" :disabled="true"></u-input>
      </u-form-item>
      <u-form-item label="负责人" prop="managerName" :required="isFields">
        <u-input placeholder="选择许可证后自动显示" v-model="retailer.managerName" :disabled="true"></u-input>
      </u-form-item>
      <u-form-item label="联系电话" prop="retailTel" :required="isFields">
        <u-input placeholder="选择许可证后自动显示" v-model="retailer.retailTel" :disabled="true"></u-input>
      </u-form-item>
      <u-form-item label="经营地址" prop="businessAddr" :required="isFields" :border-bottom="false">
        <u-input placeholder="选择许可证后自动显示" v-model="retailer.businessAddr" type="textarea" height="100" :disabled="true"></u-input>
      </u-form-item>
    </u-form>
  </view>
</template>

<script>
export default {
  components: {},
  name: "arrangeTaskRetailerList",
  props: {
    isFields: {
      type: Boolean,
      default: true,
    },
    isEdit: {
      type: String,
      default: "edit",
    },
    tdmId: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      retailer: {
        issueOrgCode: "",
        issueOrgName: "",
        issueOrgUuid: "",
        licNo: "",
        companyName: "",
        managerName: "",
        retailTel: "",
        businessAddr: "",
      },
      rules: {
        licNo: [
          {
            required: true,
            message: "请选择许可证号",
            trigger: ["blur", "change"],
          },
        ],
      },
    };
  },
  methods: {
    getRetailerInfo() {
      if (this.isEdit == "edit") {
        this.$u.route("/pages/internal/linkage/components/retailerList");
      }
    },
    checkForm() {
      let self = this;
      return new Promise((resolve, reject) => {
        let form = Object.assign({}, self.retailer);
        if (self.required) {
          self.$refs.uForm.validate((valid) => {
            if (valid) {
              resolve(form);
            } else {
              reject(1);
            }
          });
        } else {
          resolve(form);
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.u-form-m {
  padding: 0px 5px;
}
</style>
